package com.hisysteTopet.hisystepet.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hisysteTopet.hisystepet.bean.UserMessage;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMessageMapper extends BaseMapper<UserMessage> {

    // 通过用户名查看信息
    @Select("SELECT * FROM usermessage WHERE username = #{username}")
    public UserMessage userMessage(String username);

    // 通过用户名修改收获地址
    @Update("UPDATE `usermessage` SET `address` = #{address} WHERE username = #{username}")
    public void updateToAddress(String username,String address);

    // 添加用户信息
    @Insert("INSERT INTO usermessage " +
            "VALUE( #{username} , #{name},#{sex} ," +
            " #{phone} , #{address})")
    public void insertUserMessage(String username,String name,String sex,Long phone,String address);

}
